package com.zxq.ai.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 活动模式
 */
@Getter
@AllArgsConstructor
public enum ActivityStatus {

    INIT(0, "初始化"),
    SUSPEND(10, "暂停中"),
    ACTIVE(20, "进行中"),
    TERMINATE(30, "已结束"),
    ;

    private final Integer code;
    private final String desc;

    public static ActivityStatus getByCode(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }

        for (ActivityStatus value : ActivityStatus.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
